package com.dao.impl;

import com.dao.UserDao;
import com.entity.User;
import com.util.DbUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;

public class UserDaoImpl implements UserDao {
    private QueryRunner qr=new QueryRunner(DbUtil.getDds);
    @Override
    public User selectUser(String uname, String pwd) {
        String sql="select * from user where uname=? and pwd=?";

        try {
            return qr.query(sql,new BeanHandler<User>(User.class),uname,pwd);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}
